import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: '_',
            component: HomeView
        },
        {
            path: '/home',
            name: 'home',
            component: HomeView
        },
        {
            path: '/about',
            name: 'about',
            component: () => import('../views/AboutView.vue')
        },
        {
            path: '/test',
            name: 'test',
            component: () => import('../views/TestView.vue')
        },
        {
            path: '/admin',
            name: 'admin',
            component: () => import('../views/admin/AdminView.vue'),
            children: [
                {
                    path: 'home',
                    name: 'admin-home',
                    component: () => import('../views/admin/AdminHomeView.vue')
                },
                {
                    path: 'user',
                    name: 'admin-user',
                    redirect: '/admin/user/user',
                    children: [
                        {
                            path: 'user', // 用户管理
                            name: 'admin-user-user',
                            component: () => import('../views/admin/AdminUserUserView.vue')
                        },
                        {
                            path: 'role', // 角色管理
                            name: 'admin-user-role',
                            component: () => import('../views/admin/AdminUserRoleView.vue')
                        }

                    ]
                },
                {
                    path: 'game', // 游戏管理
                    name: 'admin-game',
                    redirect: '/admin/game/game',
                    children: [
                        {
                            path: 'game', // 游戏管理
                            name: 'admin-game-game',
                            component: () => import('../views/admin/AdminGameGameView.vue')
                        },
                        {
                            path: 'service', // 游戏服管理
                            name: 'admin-game-service',
                            component: () => import('../views/admin/AdminGameServiceView.vue')
                        }
                    ]
                }
            ]
        }

    ]
})

export default router
